home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _C27842852FFE48989A96E6FB8A200D27 < prev    next >
Encoding:
Text File  |  2004-01-06  |  1.7 KB  |  64 lines

  1. // ===============================================================
  2. // Vertex Program: Indoor Water
  3. // Description: used in indoor refractive water (w/ fake specular)
  4. // Last Update: 03/09/2003
  5. // Coder: Tiago Sousa
  6. // ===============================================================
  7.  
  8. #include "../CGVPMacro.csi"
  9.  
  10. VertAttributes { POSITION_3 }
  11.  
  12. // setup vertex components
  13. MainInput
  14. {
  15.   // common model view matrix
  16.   VIEWPROJ_MATRIX,
  17.   uniform float4   CameraPos,  
  18.   uniform float4   Constants,
  19.   uniform float4   NoisePos,
  20.   uniform float4   TexGenRipple0,
  21.   uniform float4   TexGenRipple1,
  22.   uniform float4   TexShiftRipple,
  23.   uniform float4   TexDetailScale  
  24. }
  25.  
  26. DeclarationsScript
  27. {
  28.   // vertex input
  29.   IN_P
  30.   // vertex output
  31.   OUT_T0_T1_C0
  32. }
  33.  
  34. // output vertex position
  35. PositionScript = PosCommon
  36.  
  37. CoreScript
  38. {
  39.   float4 vHPos = mul(ModelViewProj, vPos);                
  40.   float3 eyeVec = normalize(CameraPos.xyz - vPos.xyz);  
  41.  
  42.   float3 fNormal=float3(0,0,1);
  43.   float fDot= dot(eyeVec, fNormal);  
  44.   // output color and fresnel term hack           
  45.   OUT.Color.w =vHPos.w*0.15;     
  46.     
  47.   float2 vTex;
  48.   vTex.x = dot(vPos, TexGenRipple0);
  49.   vTex.y = dot(vPos, TexGenRipple1);
  50.   
  51.   float2 fShear= float2(cos(TexShiftRipple.z*TexDetailScale.w), sin(TexShiftRipple.w*TexDetailScale.w));    
  52.   vTex.xy= (vTex.xy+fShear.xy*0.1)*TexDetailScale.xy;
  53.  
  54.   // output texture coordinates  
  55.   OUT.Tex0.xy = vTex.xy;
  56.     
  57.   float3 fReflVec=normalize(2*fDot*fNormal-eyeVec);     
  58.   //OUT.Tex1.xy = ((fReflVec.xy+1.0)*0.5-(TexShiftRipple.zw*TexShiftRipple.xy)*TexDetailScale.w); 
  59.  
  60.   OUT.Tex1.xy = fReflVec.xy-fShear.xy*0.1;
  61.        
  62.   return OUT;
  63. }
  64.